package aor2.cpu.blockinterrupt;

import aor2.components.Register;
import aor2.components.Restorable;
import aor2.cpu.InternBus;
import aor2.cpu.blockcontrol.ControlSignalSet;

/**
 * IVTP registar
 * 
 * @author Erna
 * 
 */
public class Ivtp extends Register implements Restorable {

	public Ivtp(long startIvtpState) {
		super(startIvtpState, null, InternBus.M2);
		ControlSignalSet.getInstance().get("IVTPout").addSourceElementIO(this);
	}

	@Override
	public String toString() {
		return "IVTP: " + state;
	}

	@Override
	public void restore(String restorePoint) {
		String trim = restorePoint.replace(beginTag(), "");
		trim = trim.replace(endTag(), "");
		trim = trim.trim();
		setState(Long.parseLong(trim));
	}

	@Override
	public String createRestorePoint() {
		return beginTag() + "\n\t" + state + "\n" + endTag();
	}

	@Override
	public String beginTag() {
		return "<IVTP>";
	}

	@Override
	public String endTag() {
		return "</IVTP>";
	}

}
